#include "stdafx.h"
#include "TcpSocket.h"


CTcpSocket::CTcpSocket()
{
	m_pSocketEvent = NULL;
}


CTcpSocket::~CTcpSocket()
{
}

void CTcpSocket::SetSocketEvent(ISocketEvent * pSocketEvent)
{
	m_pSocketEvent = pSocketEvent;
}

void CTcpSocket::OnReceive(int nErrorCode)
{
	if (m_pSocketEvent)
		m_pSocketEvent->OnReceiveEvent(m_hSocket);
}

void CTcpSocket::OnAccept(int nErrorCode)
{
	if (m_pSocketEvent)
		m_pSocketEvent->OnAcceptEvent();
}

void CTcpSocket::OnClose(int nErrorCode)
{
	if (m_pSocketEvent)
		m_pSocketEvent->OnCloseEvent(m_hSocket);
}

void CTcpSocket::OnConnect(int nErrorCode)
{
	if (m_pSocketEvent)
		m_pSocketEvent->OnConnectEvent(nErrorCode);
}
